home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
STRINGS
/
PACKAGE6
/
RIGHT.DOC
< prev
next >
Wrap
Text File
|
1990-07-25
|
2KB
|
56 lines
------------------------------------------------------------------------------
RightString
------------------------------------------------------------------------------
declaration: procedure RightString ( OriginalString:
TypeString;
NumberOfChracters:
integer;
var ResultString:
TypeString);
purpose: Returns a portion of a string(original) in another
string(result).
preconditions: OriginalString was originally initiialized.
NumberOfCharacters has been a given a meaningfull value.
ResultString may be undifined.
postconditions: ResultString is filled with the desired number of characters
from the original string from left to right starting from
the point were the number of characters is from the right
to the left.
special cases: -if NumberOfCharacters <= 0 then ResultString._Length is 0 and
ResultString._PackedArray is not changed.
-if NumberOfCharacters >= OriginalString._Length then
ResultString = OriginalString.
example: var
OriginalString,
ResultString:
TypeString;
NumberOfCharacters:
integer;
LastKey:
TypeKey;
begin
.
.
.
ReadlnString (OriginalString, MaxStringLength, LastKey);
NumberOfCharacters:= 5;
RightString (OriginalString, NumberOfCharacters,
ResultString);
write(output,'The last five characters are ');
WriteString(ResultString);
writeln(output,'.')
.
.
.
end
------------------------------------------------------------------------------